<template>
  <div style="background:#fff;padding-top:50px;">
    <!-- 精选案例详情页 -->
    <div class="fluid">
      <div class="container">
        <div class="rowOne"></div>
        <div class="rowTwo">
          <div class="rowTwoL">
            <ul>
              <li class="add" :class="{'add-style':liIndex==0}" >
                <img src="../../assets/img/jxaldetail/16.png" alt="" v-if="liIndex==0">
                <img src="../../assets/img/jxaldetail/17.png" alt="" v-if="liIndex!=0">
                <a href="javascript:;" @click="one">全部案例</a>
              </li>
              <li v-for="(item,index) in result" :key="index" class="add" :class="{'add-style':liIndex==index+1}">
                <img src="../../assets/img/jxaldetail/14.png" v-if="liIndex==index+1">
                <img src="../../assets/img/jxaldetail/15.png" v-if="liIndex!=index+1">
                <a href="javascript:;" @click="change(index)">{{item.data_value}}</a>
              </li>
            </ul>
          </div>
          <div class="rowTwoR">
            <div>
              <ul class="logoList">
                <li v-for="(item,index) in result3" :key="index" @mouseover="showBtn(index)" @mouseout="hideBtn">
                  <img :src="item.logo">
                  <button v-if="show==index" @click="changeDetail(index)">查看详情</button>
                </li>
              </ul>
              <div class="project">
                <p class="top">项目名称:{{result4.projectName}}</p>
                <img :src="result4.banner" alt="" class="bannerimg">
                <div class="dv">
                  <div class="dvleft">
                    <img src="../../assets/img/jxaldetail/4.png" alt="">
                    <span>投放媒体</span>
                  </div>
                  <div class="dvright">
                    <p>{{result4.media}}</p>
                  </div>
                </div>
                <div class="dv">
                  <div class="dvleft">
                    <img src="../../assets/img/jxaldetail/5.png" alt="">
                    <span>地域定向</span>
                  </div>
                  <div class="dvright">
                    <p>{{result4.city}}</p>
                  </div>
                </div>
                <div class="dv">
                  <div class="dvleft">
                    <img src="../../assets/img/jxaldetail/6.png" alt="">
                    <span>投放时间</span>
                  </div>
                  <div class="dvright">
                    <p>{{result4.days}}</p>
                  </div>
                </div>
                <div class="dv">
                  <div class="dvleft">
                    <img src="../../assets/img/jxaldetail/7.png" alt="">
                    <span>广告形式</span>
                  </div>
                  <div class="dvright">
                    <p>{{result4.advertisementForm}}</p>
                  </div>
                </div>
                <div class="dv">
                  <div class="dvleft">
                    <img src="../../assets/img/jxaldetail/8.png" alt="">
                    <span>投放目的</span>
                  </div>
                  <div class="dvright">
                    <p>{{result4.purpose}}</p>
                  </div>
                </div>
                <div class="dv">
                  <div class="dvleft">
                    <img src="../../assets/img/jxaldetail/13.png" alt="">
                    <span>投放效果</span>
                  </div>
                  <div class="dvright">
                    <p>{{result4.result}}</p>
                  </div>
                </div>
                <div class="dv">
                  <div class="dvleft">
                    <img src="../../assets/img/jxaldetail/10.png" alt="">
                    <span>投放展示</span>
                  </div>
                  <div class="dvright dvlastright">
                    <img :src="result4.showImage" alt="">
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

  </div>
</template>
<script>
const img1 = require("../../assets/img/精选案例/切图/12.png");
const img2 = require("../../assets/img/精选案例/切图/13.png");
const img3 = require("../../assets/img/精选案例/切图/14.png");
const img4 = require("../../assets/img/精选案例/切图/15.png");
export default {
  data() {
    return {
      list: [[img1], [img4], [img4], [img4], [img4], [img4]],
      logoList: [img1, img1, img1, img1, img1, img1, img1, img1],
      show: -1,
      query: "",
      result: "",
      result1: "",
      result2: "",
      result3: "",
      result4: "",
      type: "",
      liIndex: 0
    };
  },
  created(){
 
  },
  methods: {
    showBtn(index) {
      this.show = index;
    },
    hideBtn(){
      this.show = -1;
    },
    one() {
      this.liIndex = 0;
      // 显示上面8个logo
      this.$ajax
        .post(this.Ipurl + "project/selectPage", { homeShowFlag: 1 })
        .then(res => {
          this.result3 = res.data.dataInfo.records;
          // console.log(this.result3);
          var id = this.result3[0].id;
          this.$ajax
            .post(this.Ipurl + "project/queryById" + "?id=" + id)
            .then(res => {
              this.result4 = res.data.dataInfo;
            });
        });
    },
    change(index) {
      this.liIndex = index + 1;
      // console.log( this.liIndex)
      this.type = this.result[index]["data_value"];
      // 显示上面8个logo
      this.$ajax
        .post(this.Ipurl + "project/selectPage", { type: this.type })
        .then(res => {
          this.result3 = res.data.dataInfo.records;
          // console.log(this.result3);
          var id = this.result3[0].id;
          //   下面内容
          this.$ajax
            .post(this.Ipurl + "project/queryById" + "?id=" + id)
            .then(res => {
              this.result4 = res.data.dataInfo;
            });
        });
    },
    changeDetail(index) {
      var id = this.result3[index].id;
      this.$ajax
        .post(this.Ipurl + "project/queryById" + "?id=" + id)
        .then(res => {
          this.result4 = res.data.dataInfo;
        });
    }
  },
  watch: {
    $route(to, from) {
      if (to.query.type) {
        this.type = to.query.type;
        this.$ajax
          .post(
            this.Ipurl + "sysdictionarydata/getValueListByCode" + "?dicCode=004"
          )
          .then(res => {
            this.result = res.data.dataInfo;
            for (let i = 0; i < this.result.length; i++) {
              if (this.result[i]["data_value"] == this.type) {
                this.liIndex = i + 1;
              }
            }
            this.$ajax
              .post(this.Ipurl + "project/selectPage", { type: this.type })
              .then(res => {
                this.result3 = res.data.dataInfo.records;
                // console.log(this.result3);
                var id = this.result3[0].id;
                //   下面内容
                this.$ajax
                  .post(this.Ipurl + "project/queryById" + "?id=" + id)
                  .then(res => {
                    this.result4 = res.data.dataInfo;
                  });
              });
          });
      } else if (to.query.id) {
        this.type = to.query.id;
        this.$ajax
          .post(this.Ipurl + "project/selectPage", {
            homeShowFlag: 1
          })
          .then(res => {
            this.result3 = res.data.dataInfo.records;
          });
        this.$ajax
          .post(
            this.Ipurl + "sysdictionarydata/getValueListByCode" + "?dicCode=004"
          )
          .then(res => {
            this.result = res.data.dataInfo;
            this.$ajax
              .post(this.Ipurl + "project/queryById" + "?id=" + this.query)
              .then(res => {
                this.result4 = res.data.dataInfo;
              });
          });
      }
    }
  },
  mounted() {
    if (this.$route.query.id) {
      this.query = this.$route.query.id;
      //   进入默认选择全部案例
      this.$ajax
        .post(this.Ipurl + "project/selectPage", {
          homeShowFlag: 1
        })
        .then(res => {
          this.result3 = res.data.dataInfo.records;
        });
      this.$ajax
        .post(
          this.Ipurl + "sysdictionarydata/getValueListByCode" + "?dicCode=004"
        )
        .then(res => {
          this.result = res.data.dataInfo;
          this.$ajax
            .post(this.Ipurl + "project/queryById" + "?id=" + this.query)
            .then(res => {
              this.result4 = res.data.dataInfo;
            });
        });
    } else if (this.$route.query.type) {
      this.type = this.$route.query.type;
      this.$ajax
        .post(
          this.Ipurl + "sysdictionarydata/getValueListByCode" + "?dicCode=004"
        )
        .then(res => {
          this.result = res.data.dataInfo;
          for (let i = 0; i < this.result.length; i++) {
            if (this.result[i]["data_value"] == this.type) {
              this.liIndex = i + 1;
            }
          }
          this.$ajax
            .post(this.Ipurl + "project/selectPage", { type: this.type })
            .then(res => {
              this.result3 = res.data.dataInfo.records;
              var id = this.result3[0].id;
              //   下面内容
              this.$ajax
                .post(this.Ipurl + "project/queryById" + "?id=" + id)
                .then(res => {
                  this.result4 = res.data.dataInfo;
                });
            });
        });
    } else {
      this.$ajax
        .post(
          this.Ipurl + "sysdictionarydata/getValueListByCode" + "?dicCode=004"
        )
        .then(res => {
          this.result = res.data.dataInfo;
          // console.log(this.result,"list ...")
          this.liIndex = 0;
          this.$ajax
            .post(this.Ipurl + "project/selectPage", { type: this.type })
            .then(res => {
              this.result3 = res.data.dataInfo.records;
              var id = this.result3[0].id;
              //   下面内容
              this.$ajax
                .post(this.Ipurl + "project/queryById" + "?id=" + id)
                .then(res => {
                  this.result4 = res.data.dataInfo;
                });
            });
        });
    }
  }
     
};
</script>
<style scoped>
.fluid {
  width: 100%;
  height:auto;
  background: #fff;
  padding-bottom:60px;
}
.container {
  width: 1200px;
  margin: 0 auto;
  /* height:2000px; */
  /* padding:8px; */
  background: #f8f9fd;
  overflow: hidden;
}
.rowOne {
  height: 80px;
  /* margin-top: 80px; */
}
.rowTwoL {
  width: 200px;
  float: left;
  margin-right:20px;
}
.rowTwoR {
  width: 980px;
  float: right;
}
.rowTwoL > ul {
  overflow: hidden;
}
.rowTwoL > ul > li {
  width: 195px;
  height: 80px;
  line-height: 80px;
  text-align: center;
  
}
.add{
background:#f8f9fd;
}
.add-style{
  background:#fff;
}
.rowTwoL > ul > li > a {
  font-size: 18px;
  color: rgb(34, 34, 34);
  margin-left: 10px;
  padding: 5px 0 0 0;
}
.rowTwoL > ul > li > img {
  vertical-align: middle;
}
.logoList {
  overflow: hidden;
  height:auto;
  margin-left: -40px;
  display:flex;
  flex-flow: row wrap;
}
.logoList li {
  width: 220px;
  height: 200px;
  float: left;
  justify-content: flex-start;
  flex-flow: row wrap;
  margin-left: 30px;
  margin-top:20px;
  text-align: center;
  line-height: 200px;
  position: relative;
  border-bottom: 5px solid #ee4041;
  background:#fff;
}
.logoList li > button {
  width: 100px;
  height: 30px;
  position: absolute;
  top: 50%;
  left: 50%;
  margin-top: -15px;
  margin-left: -50px;
  font-size: 16px;
  background: #ee4041;
  box-shadow: 0px 4px 19px #ed9191;
  border-radius: 20px;
  color: #fff;
}
.logoList li:hover img {
  opacity: 0.5;
  background-color: #fff;
}
.bannerimg {
  margin-bottom: 30px;
}
.logoList li:nth-child(5n),
.logoList li:nth-child(6n),
.logoList li:nth-child(7n),
.logoList li:nth-child(8n) {
  /* margin-top: 80px; */
}
.top {
  font-size: 24px;
  font-weight: bold;
  line-height:100px;
  margin-bottom:30px;
  width:100%;
 border-bottom:1px dashed #e5e6ea;
}
.dv {
  overflow: hidden;
  margin-top: 10px;
  margin-right:39px;
   font-weight:100;
}
.dvleft {
  float: left;
  width: 220px;
  height: 50px;
  line-height: 50px;
  text-align: center;
  background: url("../../assets/img/jxaldetail/2.png");
}
.dvleft span {
  font-size: 18px;
  font-weight: bold;
  margin-left: 10px;
}
.dvleft img {
  margin-top: -5px;
}
.dvright {
  float: right;
  width: 700px;
  height: 50px;
  line-height: 50px;
  background: url("../../assets/img/jxaldetail/3.png");
}
.dvlastright {
  float: right;
  width: 700px;
  height: 560px;
  line-height: 560px;
  text-align: center;
  background: url("../../assets/img/jxaldetail/11.png");
}
.dvright p {
  font-size: 18px;
  margin-left: 75px;
}
.project{
margin-top:15px;
}
</style>

